package com.java.service.impl;

import com.java.mapper.TeacherFunctionMapper;
import com.java.pojo.CheckReveal;
import com.java.pojo.Course_info;
import com.java.pojo.StudentCourse;
import com.java.pojo.Teacher_info;
import com.java.service.TeacherFunctionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * description:描述
 * author:作者
 * time:2020/11/24 21:32
 */
@Service
public class TeacherFunctionServiceImpl implements TeacherFunctionService {

    @Autowired
    private TeacherFunctionMapper teacherFunctionMapper;

    @Override
    public Teacher_info findStudentInfoByWxid(String teacheWxid){
        return teacherFunctionMapper.selectStudentInfoByWxid(teacheWxid);
    }

    public boolean alertTeacherInfo(Teacher_info teacher_info){

        return teacherFunctionMapper.alertTeacherInfo(teacher_info)==1;
    }

    public List<Course_info> findTeacherCourseByWxid(String Wxid){

        String uuid = teacherFunctionMapper.getUuidByWxid(Wxid);
        return teacherFunctionMapper.selectCourseInfoByTeacherId(uuid);
    }

    public boolean addCourseInfo(Course_info course_info){

        String  courseUuid = UUID.randomUUID().toString().replace("-","").toLowerCase();
        course_info.setUuid(courseUuid);
        String teacherWxId = course_info.getTeacher_id();
        String uuid = teacherFunctionMapper.getUuidByWxid(teacherWxId);
        course_info.setTeacher_id(uuid);
        return teacherFunctionMapper.addCourseInfo(course_info)==1;
    }

    public boolean updateCourseInfo(Course_info course_info){

        return teacherFunctionMapper.addCourseInfo(course_info)==1;
    }

    public boolean deleteCourseInfo(String courseUuid){

        return teacherFunctionMapper.deleteStudentCourseInfo(courseUuid)==1;

    }

    public boolean beginCheck(String courseUuid,String courseNow){



        return teacherFunctionMapper.beginCheck(courseUuid,courseNow)==1;
    }
    public boolean endCheck(String courseUuid){
        return teacherFunctionMapper.endCheck(courseUuid)==1;
    }

    public List<CheckReveal> checkListReveal(String courseId,String courseNum){
        return teacherFunctionMapper.checkListReveal(courseId, courseNum);
    }



}
